home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 February / EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso / enigma / earcd / comm / comm1 / klrkcmsr.lha / Comment_Routines.C < prev    next >
C/C++ Source or Header  |  1995-12-17  |  2KB  |  98 lines

  1. #define COMMENT_ROUTINES
  2.  
  3. #include "Comment.H"
  4.  
  5. BOOL CompareNames ( char *Name , BOOL CompareType )
  6. {
  7.     char    CompareName[32];
  8.     struct Node *node;
  9.     BOOL    success = FALSE;
  10.  
  11.     for ( node = (struct Node *) KC_Users0List.mlh_Head ; node->ln_Succ; node = node->ln_Succ )
  12.     {
  13.         if ( CompareType == STRICT_COMPARE )
  14.         {
  15.             if ( stricmp ( Name , node->ln_Name ) == 0 )
  16.             {
  17.                 success = TRUE;
  18.                 break;
  19.             }
  20.         }
  21.         else
  22.         {
  23.             // The strstr() function is case sensitive, so we need to make them
  24.             // both uppercase. As the strupr() functions changes the case forever,
  25.             // we need to copy it first from the list or else the name in the
  26.             // list will STAY uppercase and we don't want that.
  27.             strcpy ( CompareName , node->ln_Name );
  28.             strupr ( CompareName );
  29.             strupr ( Name );
  30.             if ( strstr ( CompareName , Name ) != NULL )
  31.             {
  32.                 success = TRUE;
  33.                 break;
  34.             }
  35.         }
  36.     }
  37.                 
  38.     if ( success )
  39.         rc_node = (struct receiver_node *) node;
  40.  
  41.     return ( success );
  42. }
  43.  
  44. BOOL CompareInfo ( char *Name )
  45. {
  46.     char    CompareName[80];
  47.     struct Node *node;
  48.     struct receiver_node *rnode;
  49.     BOOL    success = FALSE;
  50.  
  51.     for ( node = (struct Node *) KC_Users0List.mlh_Head ; node->ln_Succ; node = node->ln_Succ )
  52.     {
  53.         // The strstr() function is case sensitive, so we need to make them
  54.         // both uppercase. As the strupr() functions changes the case forever,
  55.         // we need to copy it first from the list or else the name in the
  56.         // list will STAY uppercase and we don't want that.
  57.         rnode = (struct receiver_node *) node;
  58.         strcpy ( CompareName , rnode->rc_info );
  59.         strupr ( CompareName );
  60.         strupr ( Name );
  61.         if ( strstr ( CompareName , Name ) != NULL )
  62.         {
  63.             success = TRUE;
  64.             break;
  65.         }
  66.     }
  67.                 
  68.     if ( success )
  69.         rc_node = rnode;
  70.  
  71.     return ( success );
  72. }
  73.  
  74. BOOL ToNumber ( char *temp2 )
  75. {
  76.     struct Node *node;
  77.     struct receiver_node *rc_ptr;
  78.     BOOL    success = FALSE;
  79.  
  80.     if ( atoi ( temp2 ) > 0 )
  81.     {
  82.         for ( node = (struct Node *) KC_Users0List.mlh_Head ; node->ln_Succ; node = node->ln_Succ )
  83.         {
  84.             rc_ptr = (struct receiver_node *) node;            
  85.             if ( rc_ptr->rc_number == atoi ( temp2 ) )
  86.             {
  87.                 success = TRUE;
  88.                 break;
  89.             }
  90.         }
  91.     }
  92.  
  93.     if ( success )
  94.         rc_node = rc_ptr;
  95.  
  96.     return ( success );
  97. }
  98.